var order = []
Page({
  data: {
    imgUrls: [
      'http://img.ehalfresh.com/ejsimage/images/admobile/7a75a6d3-8e98-4510-9796-447f65653556.jpg',
      'http://img.ehalfresh.com/ejsimage/images/admobile/a13191e0-9b75-445d-bb3e-4e4dab2e6afd.jpg',
      'http://img.ehalfresh.com/ejsimage/images/admobile/d56407e2-2c99-491a-950d-ea264343d8f9.jpg',
      'http://img.ehalfresh.com/ejsimage/images/admobile/5acf7573-30ec-4c24-9208-bf04b841f6ad.jpg'
    ],
    indicatorDots: false,
    autoplay: false,
    interval: 2000,
    duration: 800,

    toView: 'red',
    scrollTop: 100,

    goods: [{
      id: 1,
      shopName: "盛亚福源自营旗舰店",
      title: '盛亚福源 牛肉黄金烤肠 500g',
      detail: '满99包邮 正品清真肠，德国工艺，制作考究，使用清真牛肉精心制作而成，体会异域风味，追求品质生活。',
      price: "24.50",
      parameter: '125g/个',
      Stock: "265",//库存
      Sale: 365,
      image: 'http://img.ehalfresh.com/ejsimage/images/seller/17/dcd34ae0-0e98-426a-9597-fad62b0b6435.jpg'
    },{
      id: 1,
      shopName: "科尔沁食品生态馆",
      title: '黑椒牛排150g',
      detail: '满99包邮 钜惠来袭 原切真牛排满99包邮 钜惠来袭 原切真牛排 购买5片以上送刀叉一副，再赠牛杂一包。购买10片以上，再送牛肉丸一包。',
      price: "265.50",
      parameter: '450g/个',
      Stock: "245",
      Sale: 569,
      image: 'http://img.ehalfresh.com/ejsimage/images/seller/17/e6fd2cc6-d73f-4103-8f22-c9a3a6fd526b.jpg'
    },
    
    ]
  },


  upper: function (e) {
    console.log(e)
  },
  lower: function (e) {
    console.log(e)
  },
  scroll: function (e) {
    console.log(e)
  },
  tap: function (e) {
    for (var i = 0; i < order.length; ++i) {
      if (order[i] === this.data.toView) {
        this.setData({
          toView: order[i + 1]
        })
        break
      }
    }
  },
  tapMove: function (e) {
    this.setData({
      scrollTop: this.data.scrollTop + 10
    })
  },

  // 定义事件
  tappro:function(e){
    var id= e.target.dataset.val;
    wx.setStorageSync("cateId",id)
    wx.switchTab({
      url:"category/category"
    })
  },
  // onLoad(){
  //   wx.setStorage({
  //     key: 'address',
  //     data: [],
  //   })
  // }
})
